package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by Administrator on 2017/2/6.
 */

@Controller
public class Hello {
    @RequestMapping("/ok.do") @ResponseBody
    public void ok(HttpServletResponse res){
        res.setCharacterEncoding("utf-8");
        res.setContentType("text/html;setcharset=utf-8");
        try {
            PrintWriter out = res.getWriter();
            System.out.println("开学第一天");
            out.print("一起学习springmvc");
            out.flush();
            out.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @RequestMapping("/hello.action") @ResponseBody
    public String hello(){
       return "学习springmvc";
    }



}
